Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

400
Vistas
Ngrok > Nginx > localhost ports

I have two node servers running on ports 3000 and 4000. If I had NGINX running and pointed ngrok at it, is there a way I can redirect requests from ngrok subfolders to each node server? eg abc123.nrgok.io/a goes to port 3000, abc123.ngrok.io/b goes to port 4000. There are several routes for each node server and some static html files too.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

In the end I scrapped NGINX and instead ran a third node server which just had http-proxy-middleware running. That seemed to work much better but I did need to change the links in both apps to point at the sub folder and then rewrite the head in the new Node server (eg all the links went from style.css to /serverOne/style.css and then the proxy middleware strips off the /serverOne bit). Code below for the third Node server.

const http = require('http'),
    express = require('express'),
    { createProxyMiddleware } = require('http-proxy-middleware')
const app = express()

app.use('/serverOne', createProxyMiddleware({target:'http://localhost:4000', changeOrigin: true, pathRewrite: {'^/serverOne' : '/'}}))
app.use('/serverTwo', createProxyMiddleware({target:'http://localhost:3000', changeOrigin: true, pathRewrite: {'^/serverTwo' : '/'}))

app.listen(2000);
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda